﻿using WeBlog.Resources;

namespace WeBlog.Models
{
    public enum CommentStatuses : int
    {        
        Any = 0,
        Pending = 1,
        Approved = 2
    }

    public class CommentStatus
    {
        public int Value { get; private set; }

        public override string ToString()
        {
            switch(Value)
            {
                case 0:
                    return Strings.CommentStatus_Any;
                case 1:
                    return Strings.CommentStatus_Pending;
                case 2:
                    return Strings.CommentStatus_Approved;
            }

            return string.Empty;
        }

        private CommentStatus()
            : this(default(CommentStatuses))
        { }

        public CommentStatus(int value)
        {
            Value = value;
        }

        public CommentStatus(CommentStatuses type)
        {
            Value = (int)type;
        }

        public static implicit operator int(CommentStatus type)
        {
            return type.Value;
        }

        public static implicit operator CommentStatus(int value)
        {
            return new CommentStatus(value);
        }

        public static implicit operator CommentStatuses(CommentStatus type)
        {
            return (CommentStatuses)type.Value;
        }

        public static implicit operator CommentStatus(CommentStatuses type)
        {
            return new CommentStatus(type);
        }
    }

}
